/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package soatonline.gui;

import java.awt.Color;
import java.awt.MouseInfo;
import java.awt.Point;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import soatonline.VO.Fondo;
import soatonline.VO.TestConnection;

/**
 *
 * @author Oskar
 */
public class FrameActualizar_Datos extends javax.swing.JFrame {

    TestConnection con = new TestConnection();
    int x, y;

    /**
     * Creates new form FrameActualizar_Datos
     */
    public FrameActualizar_Datos() {
        setUndecorated(true);
        initComponents();
        this.ponerfondo("/imagenes/LogoFinal.png");
        setLocationRelativeTo(null);
        Bloquear();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        Warning = new javax.swing.JLabel();
        jTFCiudad = new javax.swing.JTextField();
        jLBCelular = new javax.swing.JLabel();
        jTFCelular = new javax.swing.JTextField();
        jTFTelefono = new javax.swing.JTextField();
        jLBDireccion = new javax.swing.JLabel();
        jTFEmail = new javax.swing.JTextField();
        jTFDepartamento = new javax.swing.JTextField();
        jLBDepartamento = new javax.swing.JLabel();
        jLBTelefono = new javax.swing.JLabel();
        jTFApellido = new javax.swing.JTextField();
        jLBEmail = new javax.swing.JLabel();
        jLBNumero_Documento = new javax.swing.JLabel();
        jLBCelularE = new javax.swing.JLabel();
        jLBTfijoE = new javax.swing.JLabel();
        jLBApellidoE = new javax.swing.JLabel();
        jLBNdocumentoE = new javax.swing.JLabel();
        jLBNombreE = new javax.swing.JLabel();
        jLBCiudad = new javax.swing.JLabel();
        jLBDepartamentoE = new javax.swing.JLabel();
        jLBApellido = new javax.swing.JLabel();
        jTFDireccion = new javax.swing.JTextField();
        jLBEmailE = new javax.swing.JLabel();
        jLBDireccionE = new javax.swing.JLabel();
        jLBCiudadE = new javax.swing.JLabel();
        jTFNumero_Documento = new javax.swing.JTextField();
        jTFNombre = new javax.swing.JTextField();
        jLNombre = new javax.swing.JLabel();
        jBConsultar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jBModificar = new javax.swing.JButton();
        jBActualizar = new javax.swing.JButton();
        jTFID = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jPanel1MousePressed(evt);
            }
        });
        jPanel1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                jPanel1MouseDragged(evt);
            }
        });

        jTFCiudad.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLBCelular.setText("Celular");

        jTFCelular.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jTFTelefono.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLBDireccion.setText("Direccion");

        jTFEmail.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jTFDepartamento.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLBDepartamento.setText("Departamento");

        jLBTelefono.setText("Telefono Fijo");

        jTFApellido.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLBEmail.setText("Email");

        jLBNumero_Documento.setText("Numero documento");

        jLBCiudad.setText("Ciudad");

        jLBApellido.setText("Apellido");

        jTFDireccion.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jTFNumero_Documento.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jTFNombre.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLNombre.setText("Nombre");

        jBConsultar.setText("Consultar");
        jBConsultar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jBConsultarMouseReleased(evt);
            }
        });

        jLabel1.setText("Por favor digite el numero de identificacion del cliente");

        jBModificar.setText("Modificar");
        jBModificar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jBModificarMouseReleased(evt);
            }
        });

        jBActualizar.setText("Actualizar");
        jBActualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBActualizarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLBNumero_Documento)
                        .addGap(22, 22, 22)
                        .addComponent(jLBNdocumentoE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLBDepartamento)
                        .addGap(11, 11, 11)
                        .addComponent(jLBDepartamentoE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLBNombreE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(Warning, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jTFID)
                            .addGap(26, 26, 26)
                            .addComponent(jBConsultar))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jTFNumero_Documento, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTFEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTFNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTFDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLBEmail)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLBEmailE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLBDireccion)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLBDireccionE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jBModificar)
                                    .addComponent(jTFDepartamento, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(50, 50, 50)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jBActualizar)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLBCiudad)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLBCiudadE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLBCelular)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLBCelularE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLBApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLBApellidoE, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jTFApellido, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLBTelefono)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLBTfijoE, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jTFTelefono)
                                    .addComponent(jTFCelular)
                                    .addComponent(jTFCiudad))))))
                .addContainerGap(39, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addComponent(Warning, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jBConsultar)
                    .addComponent(jTFID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLBApellidoE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLBApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLBNombreE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLNombre))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTFNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTFApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLBNumero_Documento)
                            .addComponent(jLBNdocumentoE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLBTelefono))
                        .addGap(6, 6, 6)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTFNumero_Documento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTFTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(6, 6, 6)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLBEmail)
                                    .addComponent(jLBCelular)
                                    .addComponent(jLBEmailE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTFEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTFCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(10, 10, 10)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLBCiudad)
                                            .addComponent(jLBDireccion)
                                            .addComponent(jLBCiudadE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jTFDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jTFCiudad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(10, 10, 10)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLBDepartamento, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLBDepartamentoE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jTFDepartamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jLBDireccionE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jLBCelularE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLBTfijoE, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 74, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBModificar)
                    .addComponent(jBActualizar))
                .addGap(49, 49, 49))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void ponerfondo(String url) {
        this.jPanel1.add(new Fondo(this.getSize(), url));
        repaint();
    }

    private boolean verificar(JTextField jt) {

        String campo = jt.getText();
        String replaceAll = campo.replaceAll(" +", " ");
        campo = campo.trim();
        if (campo.length() == 0) {
            return false;
        }
        return true;
    }

    private void InformacionCampos(java.awt.event.ActionEvent e) {
        if (this.jTFNombre.getText().equals("") || this.jTFApellido.getText().equals("")
                || this.jTFNumero_Documento.getText().equals("") || this.jTFTelefono.getText().equals("") || this.jTFCelular.getText().equals("")
                || this.jTFEmail.getText().equals("") || this.jTFDireccion.getText().equals("") || this.jTFCiudad.getText().equals("") || this.jTFDepartamento.getText().equals("")) {
            this.Warning.setText("Los campos marcados son obligatorios *");
            this.Warning.setForeground(new Color(255, 0, 0));

        }
        if (this.jTFNombre.getText().equals("")) {
            this.jLBNombreE.setText("*");
            this.jLBNombreE.setForeground(new Color(255, 0, 0));
        }
        if (this.jTFApellido.getText().equals("")) {
            this.jLBApellidoE.setText("*");
            this.jLBApellidoE.setForeground(new Color(255, 0, 0));
        }

        if (this.jTFNumero_Documento.getText().equals("")) {
            this.jLBNdocumentoE.setText("*");
            this.jLBNdocumentoE.setForeground(new Color(255, 0, 0));
        }
        if (this.jTFTelefono.getText().equals("")) {
            this.jLBTfijoE.setText("*");
            this.jLBTfijoE.setForeground(new Color(255, 0, 0));
        }
        if (this.jTFCelular.getText().equals("")) {
            this.jLBCelularE.setText("*");
            this.jLBCelularE.setForeground(new Color(255, 0, 0));
        }
        if (this.jTFEmail.getText().equals("")) {
            this.jLBEmailE.setText("*");
            this.jLBEmailE.setForeground(new Color(255, 0, 0));
        }
        if (this.jTFDireccion.getText().equals("")) {
            this.jLBDireccionE.setText("*");
            this.jLBDireccionE.setForeground(new Color(255, 0, 0));
        }
        if (this.jTFCiudad.getText().equals("")) {
            this.jLBCiudadE.setText("*");
            this.jLBCiudadE.setForeground(new Color(255, 0, 0));
        }
        if (this.jTFDepartamento.getText().equals("")) {
            this.jLBDepartamentoE.setText("*");
            this.jLBDepartamentoE.setForeground(new Color(255, 0, 0));
        }
    }
    private void jBModificarMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBModificarMouseReleased
        if (verificar(jTFID)) {
            Desbloquear();
            jTFNombre.requestFocus();
        } else {
            JOptionPane.showMessageDialog(this, "Por favor ingrese el numero de identificacion");
            jTFID.requestFocus();
        }

    }//GEN-LAST:event_jBModificarMouseReleased

    private void jBConsultarMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBConsultarMouseReleased
        try {
            String a = (jTFID.getText());
            ResultSet res = con.Consulta("Select nombre,apellido,numero_identificacion,telefono,celular,email,direccion,ciudad,departamento "
                    + "from cliente where numero_identificacion='" + a + "'");
            if (verificar(jTFID)) {

                if (res.next()) {
                    jTFNombre.setText(res.getString("nombre"));
                    jTFApellido.setText(res.getString("apellido"));
                    jTFNumero_Documento.setText(res.getString("numero_identificacion"));
                    jTFTelefono.setText(res.getString("telefono"));
                    jTFEmail.setText(res.getString("email"));
                    jTFCelular.setText(res.getString("celular"));
                    jTFDireccion.setText(res.getString("direccion"));
                    jTFCiudad.setText(res.getString("ciudad"));
                    jTFDepartamento.setText(res.getString("departamento"));
                    Bloquear();

                } else {

                    JOptionPane.showMessageDialog(null, "El cliente no existe, Intente de nuevo");
                    jTFID.setText("");
                    jTFID.requestFocus();
                    Limpiar();
                }
                
            }else{
                JOptionPane.showMessageDialog(this,"Por favor ingrese el numero de identificacion");
                jTFID.requestFocus();
                Bloquear();
            }
            con.cerrar();
        } catch (SQLException e) {
        }

    }//GEN-LAST:event_jBConsultarMouseReleased

    private void jPanel1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MousePressed
        x = evt.getX();
        y = evt.getY();
    }//GEN-LAST:event_jPanel1MousePressed

    private void jPanel1MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseDragged
        Point point = MouseInfo.getPointerInfo().getLocation();
        setLocation(point.x - x, point.y - y);
    }//GEN-LAST:event_jPanel1MouseDragged

    private void jBActualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBActualizarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBActualizarActionPerformed
    private void Limpiar() {
        jTFNombre.setText("");
        jTFApellido.setText("");
        jTFNumero_Documento.setText("");
        jTFTelefono.setText("");
        jTFEmail.setText("");
        jTFCelular.setText("");
        jTFDireccion.setText("");
        jTFCiudad.setText("");
        jTFDepartamento.setText("");

    }

    private void Bloquear() {
        jTFNombre.setEnabled(false);
        jTFApellido.setEnabled(false);
        jTFNumero_Documento.setEnabled(false);
        jTFTelefono.setEnabled(false);
        jTFEmail.setEnabled(false);
        jTFCelular.setEnabled(false);
        jTFDireccion.setEnabled(false);
        jTFCiudad.setEnabled(false);
        jTFDepartamento.setEnabled(false);
    }

    void Desbloquear() {
        jTFNombre.setEnabled(true);
        jTFApellido.setEnabled(true);
        jTFNumero_Documento.setEnabled(true);
        jTFTelefono.setEnabled(true);
        jTFEmail.setEnabled(true);
        jTFCelular.setEnabled(true);
        jTFDireccion.setEnabled(true);
        jTFCiudad.setEnabled(true);
        jTFDepartamento.setEnabled(true);

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrameActualizar_Datos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrameActualizar_Datos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrameActualizar_Datos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrameActualizar_Datos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FrameActualizar_Datos().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Warning;
    private javax.swing.JButton jBActualizar;
    private javax.swing.JButton jBConsultar;
    private javax.swing.JButton jBModificar;
    private javax.swing.JLabel jLBApellido;
    private javax.swing.JLabel jLBApellidoE;
    private javax.swing.JLabel jLBCelular;
    private javax.swing.JLabel jLBCelularE;
    private javax.swing.JLabel jLBCiudad;
    private javax.swing.JLabel jLBCiudadE;
    private javax.swing.JLabel jLBDepartamento;
    private javax.swing.JLabel jLBDepartamentoE;
    private javax.swing.JLabel jLBDireccion;
    private javax.swing.JLabel jLBDireccionE;
    private javax.swing.JLabel jLBEmail;
    private javax.swing.JLabel jLBEmailE;
    private javax.swing.JLabel jLBNdocumentoE;
    private javax.swing.JLabel jLBNombreE;
    private javax.swing.JLabel jLBNumero_Documento;
    private javax.swing.JLabel jLBTelefono;
    private javax.swing.JLabel jLBTfijoE;
    private javax.swing.JLabel jLNombre;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTFApellido;
    private javax.swing.JTextField jTFCelular;
    private javax.swing.JTextField jTFCiudad;
    private javax.swing.JTextField jTFDepartamento;
    private javax.swing.JTextField jTFDireccion;
    private javax.swing.JTextField jTFEmail;
    private javax.swing.JTextField jTFID;
    private javax.swing.JTextField jTFNombre;
    private javax.swing.JTextField jTFNumero_Documento;
    private javax.swing.JTextField jTFTelefono;
    // End of variables declaration//GEN-END:variables
}
